#pragma once

#include "LevelElement.h"
class CubePhysX;
class NxShape;
class Character;
class PhysX;
class NxRevoluteJoint;
class DX10ObjMesh;
class D3DApp;
/**
* This class creates a pickable item by adding a ghost object
* that encapsulates it. When a player character "triggers" the ghost
* object the object will be added to the inventory of the player character.
* @author Koen Samyn
*/
class Door : public LevelElement
{
public:
	/**
	* Creates a new pickable item.
	*/
	Door(Level* pLevel,D3DXVECTOR3 location, float yRot, D3DApp* app);

	/**
	* Destroys the pickable item.
	*/
	virtual ~Door(void);

	/**
	* Override this method to implement the physics behaviour of this object.
	*/
	virtual void Tick(const InputState&  dTime);

	/**
	* Draw the D3DObject in the scene.
	* Needs definition in derived class
	*/
	virtual void Draw(const RenderContext* context, ID3D10ShaderResourceView* shadowdepthmap = 0) ;
	/*************************************************************************
	* implement this in derived class to initalize
	*/
	virtual void Initialize(ContentManager *pContentManager);


	/**
	* Called when the trigger is entered.
	*/
	virtual void OnTriggerEnter(Character* player);

	/**
	* Called when the trigger is left.
	*/
	virtual void OnTriggerExit(Character* player);

	/**
	* Disable calling OnTriggerEnter and OnTriggerExit.
	*/
	virtual void DisableTrigger();

private:

	D3DXVECTOR3 m_Location;
	float m_YRot;
	bool m_Rotate;
	DX10ObjMesh* m_pDoorMesh;
	CubePhysX* m_pCollisionMesh;
	CubePhysX* m_pTriggerMesh;
	NxRevoluteJoint* m_pHinge;
	D3DApp* m_app;

	PhysX* m_pPhysX;
};
